/**
 * 
 */
package org.ikongfuzi.common;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import org.ikongfuzi.ReaderRSS;

/**
 * @author kelch
 *
 */
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true")
public class Userinfo implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -9116998841366427454L;

	public Userinfo(){
		super();
	}
	@PrimaryKey      @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;
	@Persistent
	private String nickName;
	@Persistent
	private String passWord;
	@Persistent
	private String email;
	@Persistent
	private List<Long> channels = new ArrayList<Long>();
	
	public Userinfo(String nickName, String passWord, String email) {
		super();
		this.nickName = nickName;
		this.passWord = passWord;
		this.email = email;
		List<Rssinfo> chnl = new ReaderRSS().getRssinfoByDef("true");
		
		Iterator<Rssinfo> itr = chnl.iterator();
		Rssinfo rss = null;
		while(itr.hasNext()){
			rss = itr.next();
			channels.add(rss.getId());
		}
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getNickName() {
		return nickName;
	}
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	public String getPassWord() {
		return passWord;
	}
	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public List<Long> getChannels() {
		return channels;
	}
	public void setChannels(List<Long> channels) {
		this.channels = channels;
	}
	
	
}
